function clearProgrammeSelection(){
	$('input[name=breakout1],input[name=breakout2],input[name=main],input[name=post1],input[name=post2]').attr('checked',false);
}

function showNewAddress(){
	$(".newAddressTr").show();
}

function hideShowConfPack(divclassprefix, checkboxselector, selectedPackageId){
	var selected = $("#"+checkboxselector+selectedPackageId).is(':checked');
	for(var i=1; i<=3; i++){
		var divSelector = "#"+divclassprefix+i;
		var cbSelector = "#"+checkboxselector+i;
		if(selectedPackageId==i){
			if(i==1 || i==3){
				if(selected)
					$(divSelector).show();
				else
					$(divSelector).hide();
			}
				
		} else {
			if(i==1 || i==3)
				$(divSelector).hide(); //hide all other
			if(selected)
				$(cbSelector).attr('checked',false); //uncheck all other
		}
			
	}
}

function clicksubmit(inputname){
	$("input[name="+inputname+"]").click();
}

function validateSelectAtLeastOne(){
	if(!atleastSingleCheckbox()){
		alert("Please check at least 1 checkbox");
		return false;
	}
	return true;
}

function atleastSingleCheckbox(){
	$.fn.exists = function () {
	    return this.length !== 0;
	};
	var i=0;
	while($("#selectedContentIds"+i+"1").exists()) {
		if($("#selectedContentIds"+i+"1").is(':checked')){
			return true;
		}
		i++;
	}
	return false;
}
function exactlySingleCheckbox(){
	$.fn.exists = function () {
	    return this.length !== 0;
	};
	var i=0;
	var count=0;
	while($("#selectedContentIds"+i+"1").exists()) {
		if($("#selectedContentIds"+i+"1").is(':checked')){
			count++;
		}
		i++;
	}
	return count==1;
}